var p = new Promise(
    (resolve,rejected)=> {
        setTimeout(()=>{
            if(Math.random()- 0.5 > 0){
                resolve('success');
            }else {
                rejected('faild');
            }
        },1000);
    }
);

p.then((res)=>{
    console.log(res);
},(res)=>{
    console.log(res);
});